In the last decade, dealing with ever more complex polymorphic viruses has been one of the prominent challenges faced by the anti-virus industry. The traditional approach of emulating polymorphic decryption loops to reach the constant virus body underneath is widely regarded as the most powerful defense against polymorphism. Once decrypted, the virus body can be used for detection purposes and lends itself to a detailed analysis. Unfortunately, this approach is computationally expensive and reaches its limits when faced with metamorphic viruses.
The present invention is an alternative solution entailing code optimization (simplification) techniques. Such techniques as copy propagation, constant folding, code motion, and dead-code elimination may be used instead of, or prior to, emulation or other malicious code detection techniques. These turn out to be powerful allies in the fight against malicious code.